#include <ros/ros.h>
#include"std_msgs/builtin_uint32.h"

void data_callback(std_msgs::UInt32 databuf)
{
    ROS_INFO("RH:%d.%d\n", (databuf.data >> 24) & 0xff, (databuf.data >> 16) & 0xff); 
    ROS_INFO("TMP:%d.%d\n", (databuf.data >> 8) & 0xff, databuf.data & 0xff);
}

int main(int argc, char *args[])
{
    ros::init(argc, args, "data_read");
    ros::NodeHandle n;

    ros::Subscriber sub = n.subscribe("dht11_data", 1, data_callback);

    ROS_INFO_STREAM("data read node start succeed!");

    ros::Rate rate(10);

    while (ros::ok())
    {
        ros::spinOnce();
        rate.sleep();
    }

    return 0;
}